<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>经纪人注册</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" href="../../css/public-heder-Reset.css">
	<link rel="stylesheet" href="../../css/input-button.css">
<style>
	.prompt{width:100%;height:100%;background:rgba(0,0,0,0.3);position:fixed;top:0;left:0;z-index:222;display:none;}
	.prompt .prompt-bac{width:280px;background:#fff;border-radius:10px;position:absolute;left:50%;text-align:center;top:50%;margin:-80px 0 0 -140px;z-index:222;}
	.prompt-bac p{font-size:12px;color:#000;line-height:14px;border-bottom:1px solid #e1e1e1;white-space:;overflow:hidden;padding:16px 5px;}
	.prompt-bac span{display:block;font-size:18px;color:#0078ff;line-height:18px;padding:16px 0;}
</style>	
</head>
<body>
	<!-- page_box -->
	<div class="page-box">
		<!-- header -->
		<header class="page-header">
			<a href="javascript:history.go(-1)"  class="back"></a>
			<p class="pege-name">经纪人注册</p>
			<a class="login" href="../login.html">登录</a>
		</header>
		<div class="liubai"></div>
		<!-- header /-->
		<!-- User-information -->
		<div class="User-information">
			<div class="User-form">
				<div class="phone-number">
					<label>
						<input type="tel" class="reewrw" style="font-size:17px" placeholder="请输入您的手机号" maxlength="11">
						<span class="phone"></span>
					</label>
				</div>
				<div class="Verification-code">
					<label>
						<input type="tel" class="yanzm eliminate" style="font-size:17px" maxlength="6" placeholder="请输入验证码">
						<span class=""></span>
					</label>
					<em class="phone-code">获取验证码</em>
				</div> 
				<div class="password">
					<label>
						<input type="password" class="eliminate" style="font-size:17px" maxlength="18" placeholder="请输入登录密码！">
						<span class=""></span>
					</label>
				</div> 
				<div class="Recommended">
					<label>
						<input type="text" class="tjren" readonly="value" style="font-size:17px" placeholder="一级推荐人（必填）">
						<span class=""></span>
					</label>
				</div> 
			</div>	
			<div class="User_agreement">
				<label>
					<div class="checkboxFour fl">
					  	<input type="checkbox" checked="checked" value="1" id="checkboxFourInput" name="" />
					    <label for="checkboxFourInput"></label>
		  			</div>
		  			<p class="fl">阅读并接受</p>
					<a href="https://mobile.ibeibeili.com/weixin/html/More/M-article-51.html">《用户注册协议》</a>
				</label>
			</div>
			<div class="submit-btn">
				<button style="border:none" disabled="disabled">注册</button>
			</div>
		</div>
		<!-- User-information / -->
		<!--  -->
		<div class="prompt">
			<div class="prompt-bac">
				<p></p>
				<span class="backTo">确认</span>
			</div>
		</div>
	</div>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/http-url.js"></script>
<script type="text/javascript" src="../../js/md5.js"></script>
<script type="text/javascript">  
// 获取邀请码
function GetRequest() {   
   var url = location.search; //获取url中"?"符后的字串   
   var theRequest = new Object();  
   if (url.indexOf("?") != -1) {   
      var str = url.substr(1);   
      strs = str.split("&");   
      for(var i = 0; i < strs.length; i ++) {   
         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);   
      }   
   }   
   return theRequest;   
}   
$('.tjren').val(GetRequest().code)
// 页面加载完执行
$(function(){
	$('.phone-code').click(function() {
		if (isClick) {
			return;
		}
		var phone_number=$('.phone-number input').val().trim();
		var UserData={'phone_number':phone_number};
		// 判断号码是否符合规则
		if (!reg.test(phone_number)){
			promptBox('请输入正确的手机号码',null);
			return
		}else {
			isClick=true;
			// ajax发送手机号码 获取验证码
			ajaxRequest("/api/register",UserData,function(data) {
					if (data.m_status==610) {
						isClick=null;
						return
					}else {
						$('.phone-code').css({"color":"#ccc","borderColor":"#ccc"});
						// 发送成功禁止点击获取验证码;	
						//调用定时函数 设定剩余时间  名字 提示字符串 原本字符串 改变颜色
						timer(60,".phone-code","秒后失效","获取验证码","#6eba6f");
					}
					},false);		
		} 
	});	
	// 输入符合规则  开启提交按钮
	$("input").on("keyup", function (event) {
		var phone_number=$('.phone-number input').val().trim();
		var Veri_code=$('.Verification-code input').val().trim();
		var password=$('.password input').val();
		var recommended=$('.Recommended input').val().trim();
		//输入信息符合规则 开启提交按钮
	    if(reg.test(phone_number) && Veri_code.length==6 && password.length>=6){
		   	sureSubmit();
	    }else {
	   		cannotSubmit();
	    }
	 });
		//提交注册
	$('.submit-btn').find('button').click(function(){
		if(!document.getElementById('checkboxFourInput').checked==true){
			promptBox('请认真阅读用户注册协议！');
			return;
		}
		submitOk();
		isClick=null;
		var pawd=hex_md5($('.password input').val());
		var phone_number=$('.phone-number input').val().trim();
		var Veri_code=$('.Verification-code input').val().trim();
		var password=$('.password input').val();
		var recommended=$('.Recommended input').val().trim();
		var UserData={'phone_number':phone_number,'pawd':pawd,'Veri_code':Veri_code,'recommended':recommended,'second_agent':true}
   		ajaxRequest('/api/register/',UserData,function(data){
					
   			},false);
   	});
});

</script>
</body>
</html>